package count;

public class Count02 {
    public static void sort(int[] arr,int low,int high){
        int[] count = new int[high - low + 1];
        int[] result = new int[arr.length];
        for (int i : arr) {
            count[i - low]++;
        }
        for (int i = 1; i < count.length; i++) {
            count[i] = count[i] + count[i-1];
        }
        for (int i = arr.length - 1; i >= 0; i--) {
            result[--count[arr[i] - low]] = arr[i];
        }
        for (int i = 0; i < arr.length; i++) {
            arr[i] = result[i];
        }
    }
}
